Developments

Ambag Drive: A Free WordPress Plugin That Tracks School and Barangay Fundraising Drives

Efraim Ray Efraim Ray 0 Comments
WordPress Plugin Showcase

Every school year, PTAs, parishes, cooperatives and barangay offices run drives for classroom fans, relief packs or a chapel roof. The progress usually lives in a notebook or an old Facebook post, so donors never know how close the goal is. I built Ambag Drive, a free WordPress plugin that gives each drive a live progress bar, funded milestones, a thank-you wall and a pledge form the organizers confirm.

Ambag is Filipino for contribution. The plugin counts pesos or items, keeps pledges as Pending until the money or goods actually arrive, exports a clean CSV for the treasurer, and exposes the totals through a small REST endpoint for lobby screens and automations. It does not process payments.

Type WordPress Plugin
Backend PHP 7.4+ / WP 6.3+
Editor Block + Shortcode
Version v1.0.0
License Free · GPL-2.0+

Ambag Drive WordPress plugin: fundraising progress bar with milestones and a wp-admin contributions ledger

Try It: Pledge, Then Confirm

Left is what visitors see on a sample school's page; right is the treasurer's ledger in wp-admin. Send a pledge and notice the total does not move. Press Confirm and watch the bar, the milestones and the remaining amount update.

sanisidro-es.example/drive/classroom-fans

Community drive · sample school

Classroom Fans for San Isidro Elementary

₱31,750.50 of ₱50,000 goal

64%

    wp-admin › Contributions Ledger

    Pledges count only after you press Confirm.

    Build Footprint & Quality Checks

    School and barangay sites usually run on cheap shared hosting, so the plugin loads its small CSS and JS only on pages that show a drive. Measured on the v1.0.0 build:

    1.2
    Front-end JS
    KB gzipped
    1.8
    Front-end CSS
    KB gzipped
    0
    External Requests
    no jQuery, no CDN
    23
    Ledger Tests
    23/23 pass · 8 PHP files linted

    Technology Stack & Architecture Layers

    Platform

    WordPress 6.3+ APIs

    A custom post type for drives, meta boxes for settings and the ledger, the Shortcode API, Block API v3 and the REST API.

    Server Logic · PHP 82%

    PHP 7.4+, No Framework

    One pure Ambag_Ledger class does every total, milestone and donor-wall calculation, so the page, admin and API always agree.

    Front End · JS 11% · CSS 6%

    Vanilla JS & CSS Variables

    The bar grows and the total counts up when it scrolls into view. Without JavaScript the bar is already drawn by PHP.

    Integrations · JSON 1%

    REST Endpoint & Hooks

    /wp-json/ambag/v1/drives/<id> returns totals only, and ambag_drive_pledge_received lets n8n or SMS alerts react to new pledges.

    Key Architectural Decisions

    Pillar 01

    Pledges Are Promises

    Visitor pledges are saved as Pending and never move the public total until a person confirms them, so the bar only shows money and goods that really arrived.

    Pillar 02

    Safe Public Form

    Nonce, honeypot field, a 60-second cooldown keyed on a hash (no IP is stored), a cap on pending rows, strict amount parsing and escaping on every output.

    Pillar 03

    One Pure Logic Class

    Ambag_Ledger has no WordPress calls, so it is unit-tested with plain PHP. The tracker, list columns, CSV and REST endpoint all read from it.

    Pillar 04

    Treasurer-Friendly Export

    The CSV starts with a UTF-8 BOM so ₱ and ñ open correctly in Excel, and cells starting with = are neutralized against formula injection.

    Core Totals, Pledge Check & Usage

    Three real pieces of the plugin: the PHP function that turns the ledger into totals, the browser-side pledge check, and how you place a drive on a page.

    // includes/class-ambag-ledger.php
    /**
     * Campaign summary used by every view, the REST endpoint and the admin list.
     *
     * @param array       $entries  Clean entries.
     * @param float       $goal     Goal (0 = no goal).
     * @param string|null $deadline Y-m-d or null.
     * @param string      $today    Y-m-d in the site timezone.
     * @return array
     */
    public static function summary( array $entries, $goal, $deadline, $today ) {
        $raised   = 0.0;
        $pending  = 0.0;
        $donors   = 0;
        $pend_n   = 0;
        $largest  = 0.0;
        foreach ( $entries as $e ) {
            if ( 'pending' === $e['status'] ) {
                $pending += $e['amount'];
                ++$pend_n;
                continue;
            }
            $raised += $e['amount'];
            $largest = max( $largest, $e['amount'] );
            ++$donors;
        }
        $goal   = max( 0.0, (float) $goal );
        $pct    = $goal > 0 ? ( $raised / $goal ) * 100 : 0.0;
        $days   = null;
        $ended  = false;
        if ( $deadline && self::is_date( $deadline ) ) {
            $days  = (int) round( ( strtotime( $deadline . ' 00:00:00 UTC' ) - strtotime( $today . ' 00:00:00 UTC' ) ) / 86400 );
            $ended = $days < 0;
            $days  = max( 0, $days );
        }
        return array(
            'raised'         => round( $raised, 2 ),
            'goal'           => $goal,
            'remaining'      => round( max( 0.0, $goal - $raised ), 2 ),
            'percent'        => round( $pct, 1 ),
            'bar_percent'    => round( min( 100.0, $pct ), 1 ),
            'reached'        => $goal > 0 && $raised >= $goal,
            'donors'         => $donors,
            'average'        => $donors ? round( $raised / $donors, 2 ) : 0.0,
            'largest'        => $largest,
            'pending_count'  => $pend_n,
            'pending_amount' => round( $pending, 2 ),
            'days_left'      => $days,
            'ended'          => $ended,
        );
    }
    // assets/js/ambag.js (runs in the visitor's browser)
    document.addEventListener( 'submit', function ( e ) {
        var form = e.target.closest ? e.target.closest( '[data-ambag-form]' ) : null;
        if ( ! form ) { return; }
        var input = form.querySelector( '[data-ambag-amount]' );
        var err = form.querySelector( '[data-ambag-err]' );
        var ok = toAmount( input.value ) > 0;
        input.setAttribute( 'aria-invalid', ok ? 'false' : 'true' );
        if ( err ) { err.hidden = ok; }
        if ( ! ok ) {
            e.preventDefault();
            input.focus();
        }
    } );
    <!-- Drive page: the tracker is added automatically -->
    
    <!-- Any page or post -->
    [ambag id="12"]
    [ambag id="12" layout="compact"]
    [ambag id="12" wall="no" form="no" limit="5"]
    
    <!-- Block editor: Widgets -> "Ambag Drive" -> pick the drive -->
    
    // Read totals from anywhere (no names, no notes)
    // GET /wp-json/ambag/v1/drives/12
    
    // Send each new pledge to n8n, SMS or Messenger
    add_action( 'ambag_drive_pledge_received', function ( $drive_id, $amount ) {
        wp_remote_post( MY_N8N_WEBHOOK, array( 'body' => compact( 'drive_id', 'amount' ) ) );
    }, 10, 2 );

    Development Roadmap & Milestones

    Version 1.0.0 is released. The next milestones come straight from the project's roadmap:

    1

    v1.0.0: Core Plugin (Released)

    Drives in pesos or items, milestones, donor wall, pledge form with approval, editable ledger, CSV export, block, shortcode and REST endpoint.

    2

    Next: Expense Log

    A "where the money went" table with dates, items and receipt links, so the drive page becomes a full transparency report.

    3

    Planned: All-Drives Block

    One block that lists every active drive with a compact bar, sorted by days left, for a school or parish home page.

    4

    Planned: Filipino & Cebuano

    Translations for the visitor side, using the included ambag-drive.pot template.

    User Interface & Feature Showcase

    ₱31,750.50of ₱50,000 goal
    Alumni Batch 2001₱4,750.50
    Brgy. Council₱10,000
    Anonymous₱5,000
    Front End

    Progress Bar & Thank-You Wall

    Newest givers first; anonymous names and private notes stay hidden.

    Edit Drive › Contributions Ledger
    10-05Grade 6 PTA₱12,000Confirmed
    10-18Brgy. Council₱10,000Confirmed
    10-26Ate Liza Sari-sari₱2,000Pending
    wp-admin

    One Ledger for the Treasurer

    Add, edit, confirm or remove rows, then download a formula-safe CSV.

    GET /wp-json/ambag/v1/drives/4
    {
      "raised": 31750.5,
      "goal": 50000,
      "percent": 63.5,
      "contributions": 4,
      "days_left": 50,
      "next_milestone": {
        "amount": 50000, "label": "Library shelves"
      }
    }
    REST API

    Totals for Screens & Bots

    Public numbers only, no names, for lobby TVs, chatbots and n8n.

    Project Links, Code & Documentation

    Download & Live Demo

    Get ambag-drive.zip and install it under Plugins → Add New → Upload Plugin, or try the interactive demo of both the visitor page and wp-admin.

    Open the Live Demo

    GitHub Repository

    Browse the source, download the v1.0.0 release, or open an issue to request a feature. Free and open source under GPL-2.0-or-later.

    View on GitHub

    How It Was Built

    A plain-language build log: the languages used, every step, the real test results and what I fixed along the way.

    Read the Build Log
    Engineering Takeaway

    Transparency Your Community Can See

    A fundraising bar looks simple until you add pledges that never arrive, anonymous givers, item drives and a treasurer who needs a clean report. Ambag Drive handles all of that on a normal WordPress site. Want it set up for your school, parish or cooperative?

    Frequently Asked Questions

    Is Ambag Drive free to use?

    Yes. Ambag Drive is free and open source under the GPL-2.0-or-later license. You can download the installable zip from the GitHub releases page and use it on as many sites as you like.

    How do I install it, and does it work on Blogger?

    It is a WordPress plugin, so it needs a self-hosted WordPress site (6.3 or newer, PHP 7.4 or newer). Upload the zip in Plugins, Add New, Upload Plugin, then activate it. Blogger cannot run PHP plugins, so it will not work there.

    Does it accept GCash, bank or card payments?

    No. Ambag Drive does not process payments. You write your drop-off or bank details in the How to give box, visitors send a pledge, and you confirm it in the ledger when the money or items actually arrive.

    What information about donors does it store?

    Only the name a visitor types, which is optional, and the amount. Anonymous givers are hidden on the donor wall, private notes never appear on the site, and the 60-second spam cooldown uses a hashed key, so no IP address is saved.

    What happens to pledges that never arrive?

    They stay marked as Pending and are not added to the public total. You can remove them from the Contributions Ledger at any time, and the progress bar only moves when you confirm a row.

    Can you set this up for my school, parish or organization's website?

    Yes. I can install and configure Ambag Drive on your WordPress site, set up your drives and milestones, and connect pledge alerts to email or Messenger. Message me for a quote. Contact me here.

    The school, people and amounts in the demo are fictional. Ambag Drive records pledges and contributions; it does not collect or process payments.

    Efraim Ray
    Written by

    Efraim Ray

    Software Developer and AI Specialist. BS Information Technology graduate. I pride myself on being conscientious, attentive to detail, and always open to learning — because the best solutions come from listening, taking notes, and exploring what's next.

    Comments